
**********GLOBAL RACIST CONTAGION FOLLOWING DONALD TRUMP'S ELECTION*****************

***Dr. Marco Giani, Assistant Professor at King's College London, Deparment of Political Economy
***Prof Pierre-Guillaume Meon, Professor at Universite Libre de Bruxelles, SBS-EM


log using paper

*REPLICATION MATERIAL FOR THE PAPER

clear all
use data.dta

set more off

*You need these two packages to run the code

*ssc install ebalance
*ssc install coefplot

*******************************************************************************************
*******                                     TABLE 1
*******************************************************************************************


quietly: logit  race  trump  [pweight=dweight] if election2016==1 & interval==1, cluster(country)
quietly: margins, dydx(*) post
est store a1
quietly:logit  race  trump i.country [pweight=dweight] if election2016==1 & interval==1, cluster(country)
quietly: margins, dydx(*) post
est store a2
quietly:logit  race  trump age squaredage female domicil child minority i.country [pweight=dweight] if election2016==1 & interval==1, cluster(country) 
quietly: margins, dydx(*) post
est store a3
quietly:logit  race  trump age squaredage female domicil child minority edu hincfel uemp3m i.country [pweight=dweight] if election2016==1 & interval==1, cluster(country)
quietly: margins, dydx(*) post
est store a4
quietly:logit  race  trump age squaredage female domicil child minority edu hincfel uemp3m voting i.country [pweight=dweight] if election2016==1 & interval==1 , cluster(country) 
quietly: margins, dydx(*) post
est store a5
quietly:  ebalance  trump  age  female domicil  child minority edu hincfel uemp3m voting country if election2016==1 & interval==1 , tar(3)
quietly: logit  race  trump age squaredage female domicil child minority edu hincfel  uemp3m voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)              
quietly: margins, dydx(*) post
est store a6

*here is table 1, printed

esttab a1 a2 a3 a4 a5 a6, keep(trump) se obslast collabels(, none)  star(* 0.10 ** 0.05 *** 0.01)  wrap    nonumbers cells(b(star fmt(3)) se(fmt(3) par)) compress  


 
*******************************************************************************************
 ****                                           FIGURE 1 
*******************************************************************************************
 
 *The graphs in the paper are just aesthetically different (we exported coefficients in excel, believing they will look better)
 
**********************************************
 *** 1.A: Trump Vs Previous elections***
**********************************************

 
*BUSH 2004

quietly: ebalance  trump age  female domicil child minority edu hincfel uemp3m voting country if election2004==1, tar(3)
quietly:  logit  race  trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2004==1, cluster(country)              
quietly: margins, dydx(*) post //this is the first coefficient plotted in figure 1.a, referred to as "Bush 2004"
est store a1

*OBAMA 2008

quietly: ebalance  trump age  female domicil child minority edu hincfel uemp3m voting country if election2008==1, tar(3)
quietly: logit  race  trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2008==1, cluster(country)              
quietly: margins, dydx(*) post //this is the second coefficient plotted in figure 1.a, referred to as "Obama 2008"
est store a2

*OBAMA 2012

quietly:  ebalance  trump age  female domicil child minority edu hincfel uemp3m voting country if election2012==1, tar(3)
quietly:  logit  race  trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2012==1, cluster(country)              
quietly: margins, dydx(*) post //this is the third coefficient plotted in figure 1.a, referred to as "Obama 2012"
est store a3
 
*TRUMP 2016

quietly:  ebalance  trump  age  female domicil  child minority edu hincfel uemp3m voting country if election2016==1 & interval==1 , tar(3)
quietly: logit  race  trump age squaredage female domicil child minority edu hincfel  uemp3m voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)              
quietly: margins, dydx(*) post //this is the last coefficient plotted in figure 1.a, referred to as "Trump 2016"
est store a4
 
coefplot (a1, label(Bush 2004) pstyle(p1))  (a2, label(Obama 2008) pstyle(p2)) (a3, label(Obama 2012) pstyle(p3))  (a4, label(Trump 2016) pstyle(p4)) , keep(trump)  xlabel("")   vertical drop(_cons) yline(0)

**********************************************
 *** 1.B: Racist Vs Immigration attitudes***
**********************************************


quietly: ebalance  trump age  female domicil child minority edu hincfel  uemp3m voting country if election2016==1 & interval==1, tar(3)

*****OPPOSE POOR MIGRANTS
quietly: ologit  imstrict trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
est store a1 // coefficient for " Oppose poor Migrants"

*****OPPOSE REFUGEES
quietly: ologit  refustrict trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
est store a2 // coefficient for " Oppose Refugees"

 *****ECONOMIC CONCERNS FOR IMMIGRATION
quietly: ologit  imeco trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)     
est store a3 // coefficient for " Immigration harms Economy"

*****CULTURAL CONCERNS FOR IMMIGRATION
quietly: ologit  imueclt trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
est store a4 // coefficient for " Immigration harms Culture"    
 
coefplot (a1, label(Oppose poor migrant) pstyle(p1))  (a2, label(Oppose refugees) pstyle(p2)) (a3, label(Economy) pstyle(p3))  (a4, label(Culture) pstyle(p4)) , keep(trump)  xlabel("")  vertical drop(_cons) yline(0)

**********************************************
 *** 1.C: Electoral Vs Campaign effect***
**********************************************


*****FAKE1: 7 days before  
quietly: ebalance  trumpbefore1 age  female domicil child minority edu hincfel    uemp3m voting country if interval1==1, tar(3)
quietly: logit  race  trumpbefore1 age squaredage female domicil child minority edu hincfel   uemp3m  voting i.country [pweight=dweight* _webal] if interval1==1, cluster(country)              
quietly: margins, dydx( *) post  //This is the first coefficient plotted
est store a1
 
*****FAKE1: 15 days before  
quietly: ebalance  trumpbefore2 age  female domicil child minority edu hincfel   uemp3m voting country  if interval2==1 & country!=4, tar(3)
quietly: logit  race  trumpbefore2 age squaredage female domicil child minority edu hincfel   uemp3m  voting i.country [pweight=dweight* _webal]  if interval2==1 & country!=4, cluster(country)              
quietly: margins, dydx( *)  post //This is the second coefficient plotted
est store a2
 
*****FAKE1: 3 weeks before  
quietly: ebalance  trumpbefore3 age  female domicil child minority edu hincfel  uemp3m voting country  if interval3==1 & country!=4, tar(3)
quietly: logit  race  trumpbefore3 age squaredage female domicil child minority edu hincfel   uemp3m  voting i.country [pweight=dweight* _webal]  if interval3==1 & country!=4, cluster(country)              
quietly: margins, dydx( *) post  //This is the third coefficient plotted
est store a3
 
*****FAKE1: one month before  
quietly: ebalance  trumpbefore4 age  female domicil child minority edu hincfel  uemp3m voting country  if interval4==1 & country!=4, tar(3)
quietly: logit  race  trumpbefore4 age squaredage female domicil child minority edu hincfel   uemp3m  voting i.country [pweight=dweight* _webal]  if interval4==1 & country!=4, cluster(country)              
quietly: margins, dydx( *) post  //This is the third coefficient plotted
est store a4

coefplot (a1, label(one week) pstyle(p1))  (a2, label(15 days) pstyle(p2)) (a3, label(three weeks) pstyle(p3))  (a4, label(one month) pstyle(p4)) , keep(trumpbefore1 trumpbefore2 trumpbefore3 trumpbefore4)   xlabel("")  vertical drop(_cons) yline(0)

 
**********************************************
 *** 1.D: Electoral Vs Bandwagon effect***
**********************************************
   

quietly: ebalance  trump age  female domicil child minority edu hincfel  uemp3m voting country if election2016==1 & interval==1, tar(3)

 *****LEFT-RIGHT SCALE 
quietly: ologit  lrscale trump age squaredage female domicil child minority edu hincfel  uemp3m voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
est store a1  //This is the first coefficient plotted

*****POPULIST PARTY
quietly: ologit  populist trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
est store a2 //This is the second coefficient plotted 

*****OPPOSE REDISTRIBUTION
quietly: ologit  redistribution trump age squaredage female domicil child minority edu hincfel  uemp3m voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
est store a3  //This is the third coefficient plotted

*****OPPOSE GAY RIGHTS
quietly: ologit  homosexright trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
est store a4  //This is the last coefficient plotted

coefplot (a1, label(left-right) pstyle(p1))  (a2, label(populist) pstyle(p2)) (a3, label(redistribution) pstyle(p3))  (a4, label(homosexual right) pstyle(p4)) , keep(trump)  xlabel("")  vertical drop(_cons) yline(0)

   
********************************************************************************************************************************************************************************************************************************************************************

log close
